package com.share.boot;

import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.spring.annotation.ApolloConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * author:caifan
 * date:2019/5/15
 */
@RestController
@RequestMapping("/rest")
public class DemoController {
    @ApolloConfig
    Config config;

    @Value("${apollo.username:zhangsan}")
    private String username;

    @RequestMapping(value = "/hello", method = RequestMethod.GET)
    public String hello() {
        System.out.println("hello::" + username);
        return config.getProperty("username", "root");
    }
}
